package com.example.consumer.consumer.Controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.example.inf.infa.myfac.RemoteUserService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;

@Controller
public class userController
{

   @Autowired
    RemoteUserService rm;
    @ResponseBody
    @Reference
    //错误异常处理机制
@HystrixCommand(fallbackMethod = "hello")
@RequestMapping("/getprod")
    public String grm(String name)
{
    return rm.sayHello(name);

}

    public ArrayList hello()
    {

        ArrayList<String> adr=new ArrayList<>();
        adr.add("李梅 ， 美国");
        adr.add("刘梅 ， 中国");
        return adr;
    }

}



